import { useResponseSuccess } from '~/utils/response';

export default eventHandler(async (event) => {
  const templateId = getRouterParam(event, 'id');
  const body = await readBody(event);

  // 模拟创建模板版本
  const newVersion = {
    id: Date.now().toString(),
    templateId,
    ...body,
    status: 'ACTIVE',
    createTime: new Date().toISOString().replace('T', ' ').substring(0, 19),
    createBy: 'admin',
  };

  return useResponseSuccess({
    message: '创建版本成功',
    data: newVersion,
  });
});
